package models

import (
	"gorm.io/gorm/schema"
	"time"
)

// UserLoginRecord 用户登录记录
type UserLoginRecord struct {
	Id int64 `json:"id" gorm:"primaryKey"`
	SqlTimeFields

	Uid        int64      `json:"uid" gorm:"index"`
	LastDevice string     `json:"last_device" gorm:"type:varchar(256);"` //操作设备
	LastLogin  *time.Time `json:"last_login"`                            //上次登录时间
	LastLocate string     `json:"last_locate" gorm:"type:varchar(64);"`
	LastIp     string     `json:"last_ip" gorm:"type:varchar(20);"`
	Remark     string     `json:"remark" gorm:"type:varchar(256);"`
}

func (r UserLoginRecord) TableName(namer schema.Namer) string {
	return namer.TableName("user_login_record")
}
